package com.shujia.wyh.day11.homework;

/*
4.构造方法与重载：定义一个网络用户类，要处理的信息有用户 ID、用户密码、 email 地址。
在建立类的实例时把以上三个信息都作为构造函数的参数输入， 其中用户 ID 和用户密码时没有缺省，
而email地址缺省的时候 email地址是用户 ID 加上字符串"@gameschool.com"。

 */

class User {
    private String id;
    private String password;
    private String email;

    public User() {
    }

    public User(String id, String password, String email) {
        this.id = id;
        this.password = password;
        this.email = email;
    }

    public User(String id, String password) {
        this.id = id;
        this.password = password;
        this.email = this.id + "@gameschool.com";
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void show() {
        System.out.println("用户ID：" + id);
        System.out.println("用户密码：***********");
        System.out.println("用户email：" + email);
    }
}

public class UserDemo {
    public static void main(String[] args) {
        //创建一个用户对象
        User user1 = new User("SJ0010", "123456", "SJ0010@sj.com");
        user1.show();

        User user2 = new User("SJ0011", "123456");
        user2.show();

    }
}
